package com.lxw.nonghe.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lxw.nonghe.entity.OperationLog;
import com.lxw.nonghe.mapper.OperationLogMapper;
import com.lxw.nonghe.service.OperationLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements OperationLogService {
    private final OperationLogMapper operationLogMapper;
    @Override
    public void saveLog(OperationLog operationLog) {
        operationLogMapper.insert(operationLog);
    }
    @Override
    public List<OperationLog> getRecentLogs() {
        return operationLogMapper.selectRecentLogs();
    }
    @Override
    public IPage<OperationLog> getLogPage(Page<OperationLog> page,
                                          String username,
                                          String module,
                                          String status) {
        return operationLogMapper.selectLogPage(page, username, module, status);
    }
}
